package com.demo.encapsulation;

public final class DivideTwoNumber {

	private int x;
    private  int y; 
 
    
	public float divide(){
		return x/y;
	}

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		if(y==0){
			 System.out.println("Invalid value for y setting default value 1 to y.");
			y=1;
		}
		this.y = y;
	}

	@Override
	public String toString() {
		return "DivideTwoNumber [x=" + x + ", y=" + y + "]";
	}
 
	
	
}
